package shark.flow.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import shark.common.model.Result;
import shark.flow.service.IFlowProcessDefinitionService;
import shark.flow.vo.ProcessDefinitionQueryVo;
import shark.flow.vo.ProcessDefinitionVo;

@RestController
@RequestMapping("/definition")
public class FlowProcessDefinitionController {

    @Autowired
    private IFlowProcessDefinitionService definitionService;

    @PostMapping("/page")
    public Result<IPage<ProcessDefinitionVo>> queryDefinitionByParam(@RequestBody ProcessDefinitionQueryVo queryVo) {
        IPage<ProcessDefinitionVo> page = definitionService.getPagerModel(queryVo);
        Result<IPage<ProcessDefinitionVo>> result = new Result<>(200, "success!", page);
        return result;
    }
}
